package com.jeff.android.lab.architecture;

import com.jeff.android.lab.BaseRecyclerViewFragment;
import com.jeff.android.lab.architecture.arouter.ARouterFragment;
import com.jeff.android.lab.architecture.coroutine.CoroutineFragment;
import com.jeff.android.lab.architecture.designpattern.DesignPatternFragment;
import com.jeff.android.lab.architecture.eventbus.EventBusFragment;
import com.jeff.android.lab.architecture.jframework.JFrameworkFragment;
import com.jeff.android.lab.architecture.mmkv.MmkvFragment;
import com.jeff.android.lab.architecture.modularization.ModularizationFragment;
import com.jeff.android.lab.architecture.mvp.LoginFragment;
import com.jeff.android.lab.architecture.mvvm.MvvmFragment;
import com.jeff.android.lab.architecture.networklib.NetworklibFragment;
import com.jeff.android.lab.architecture.rxjava2.RxJava2Fragment;
import com.jeff.android.lab.util.RouterUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: duff
 * @date: 2019/1/14
 * @since: 1.0.0
 */
public class ArchitectureMainFragment extends BaseRecyclerViewFragment {

    @Override
    protected List<String> getData() {
        return new ArrayList<String>() {
            {
                add("DesignPattern"); // 设计模式
                add("JFramework"); // 我自己写的框架
                add("RxJava2"); // 第三方发布/订阅总线框架
                add("Modularization"); // 组件化
                add("ARouter"); // 阿里开源框架 ARouter
                add("EventBus"); // 第三方框架 EventBus
                add("MVP"); // MVP 架构
                add("MVVM"); // MVVM 架构
                add("NetworkLib"); // 网络状态监听框架
                add("Coroutine"); // 协程
                add("MMKV"); // mmkv
            }
        };
    }

    @Override
    protected void launch(String widget) {
        if ("DesignPattern".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), DesignPatternFragment.class);
        } else if ("JFramework".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), JFrameworkFragment.class);
        } else if ("RxJava2".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), RxJava2Fragment.class);
        } else if ("Modularization".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), ModularizationFragment.class);
        } else if ("ARouter".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), ARouterFragment.class);
        } else if ("EventBus".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), EventBusFragment.class);
        } else if ("MVP".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), LoginFragment.class);
        } else if ("MVVM".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), MvvmFragment.class);
        } else if ("NetworkLib".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), NetworklibFragment.class);
        } else if ("Coroutine".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), CoroutineFragment.class);
        } else if ("MMKV".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), MmkvFragment.class);
        }
    }

}
